<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:birt="http://jsf4birt.components"
	template="/templates/template.xhtml">
	<ui:define name="body">

		<h:outputText value="#{crossMonitoringController.onload}"></h:outputText>

		<h:form id="x">
		
			<h:outputText value="#{crossMonitoringController.loadDefaultValues()}"/>
		
			<div align="center">
				<rich:panel style="background: transparent">
					<h:panelGrid columns="6" width="100%">
						<h:outputText value="#{msg['general.departament']}" />
						<h:selectOneMenu
							value="#{crossMonitoringController.departamento}"
							styleClass="cmbForm">
							<f:selectItem itemLabel="--seleccione--" itemValue="00" />
							<f:selectItems value="#{crossMonitoringController.listaDep}" />
							<a4j:support event="onchange"
								action="#{crossMonitoringController.cargaProvincias}"
								reRender="cmbProv,cmbDist,cmbSede" />
						</h:selectOneMenu>
						<h:outputText value="#{msg['general.province']}" />
						<h:selectOneMenu id="cmbProv"
							value="#{crossMonitoringController.provincia}"
							styleClass="cmbForm">
							<f:selectItem itemLabel="--seleccione--" itemValue="00" />
							<f:selectItems
								value="#{crossMonitoringController.listaProv}" />
							<a4j:support event="onchange"
								action="#{crossMonitoringController.cargaDistrito}"
								reRender="cmbDist" />
						</h:selectOneMenu>
						<h:outputText value="#{msg['general.district']}" />
						<h:selectOneMenu id="cmbDist"
							value="#{crossMonitoringController.distrito}"
							styleClass="cmbForm">
							<f:selectItem itemLabel="--seleccione--" itemValue="00" />
							<f:selectItems value="#{crossMonitoringController.listaDis}" />
							<a4j:support event="onchange"
								action="#{crossMonitoringController.cargaComite}"
								reRender="cmbComite" />
						</h:selectOneMenu>
						<rich:spacer height="10px" />
						<rich:spacer />
						<rich:spacer />
						<rich:spacer />
						<rich:spacer />
						<rich:spacer />
						<h:outputText value="#{msg['general.sede']}" />
						<h:selectOneMenu id="cmbSede"
							value="#{crossMonitoringController.sede}"
							styleClass="cmbForm">
							<f:selectItem itemLabel="--seleccione--" itemValue="000" />
							<f:selectItems
								value="#{crossMonitoringController.listaSede}" />
						</h:selectOneMenu>
						<h:outputText value="#{msg['general.comite']}" />
						<h:selectOneMenu id="cmbComite"
							value="#{crossMonitoringController.comite}"
							styleClass="cmbForm">
							<f:selectItem itemLabel="--seleccione--" itemValue="000" />
							<f:selectItems
								value="#{crossMonitoringController.listaComite}" />
						</h:selectOneMenu>
						<rich:spacer />
						<rich:spacer />
						<rich:spacer height="10px" />
						<rich:spacer />
						<rich:spacer />
						<rich:spacer />
						<rich:spacer />
						<rich:spacer />
						<h:outputText value="#{msg['general.formato']}" />
						<h:selectOneMenu id="cmbModulos"
							value="#{crossMonitoringController.formato}"
							styleClass="cmbForm" label="Formato"	required="true">
							<f:selectItem itemLabel="--seleccione--" itemValue="" />
							<f:selectItem itemLabel="Supervision CC" itemValue="1" />
							<f:selectItem itemLabel="Supervision AA" itemValue="2" />			
							<a4j:support event="onchange"
								action="#{crossMonitoringController.cargaSupervisor}"
								reRender="cmbSupr" ajaxSingle="true"/>				
						</h:selectOneMenu>
						<h:outputText value="#{msg['general.supervisor']}" />
						<h:selectOneMenu id="cmbSupr"
							value="#{crossMonitoringController.supervisor}"
							styleClass="cmbForm">	
							<f:selectItem itemLabel="--seleccione--" itemValue="0" />
							<f:selectItems value="#{crossMonitoringController.listaSupervisor}" />
						</h:selectOneMenu>
						<rich:spacer />
						<rich:spacer />
						<rich:spacer height="10px" />
						<rich:spacer />
						<rich:spacer />
						<rich:spacer />
						<rich:spacer />
						<rich:spacer />
						<h:outputText value="#{msg['general.year']}" />
						<h:inputText value="#{crossMonitoringController.anio}" label="Ano" required="true"/>
						<h:outputText value="#{msg['general.quarter']}" />
						<h:selectOneMenu id="cmbTrimestre"
							value="#{crossMonitoringController.trimestre}"
							styleClass="cmbForm" label="Trimestre" required="true">
							<f:selectItem itemLabel="--seleccione--" itemValue="" />
							<f:selectItem itemLabel="I" itemValue="1" />
							<f:selectItem itemLabel="II" itemValue="2" />
							<f:selectItem itemLabel="III" itemValue="3" />
							<f:selectItem itemLabel="IV" itemValue="4" />
						</h:selectOneMenu>
					</h:panelGrid>
					<rich:spacer height="30px" />
					<rich:messages layout="table" tooltip="true" showDetail="false" showSummary="true" style="font: red;">
					<f:facet name="errorMarker">
						<h:graphicImage url="/images/error.gif"	 />
					</f:facet>
				</rich:messages>
					<a4j:commandButton value="#{msg['general.processReport']}"
						action="#{crossMonitoringController.generarReporte()}"
						type="button"
						onclick="Richfaces.showModalPanel('pnlModalProcess');"
						oncomplete="Richfaces.hideModalPanel('pnlModalProcess');" 
						reRender="messagesPanel,reportFilePanel"/>
				</rich:panel>
			</div>

			<rich:spacer height="20px" />
			


		<rich:spacer height="20"/>
        
        <a4j:outputPanel id="messagesPanel"> 
        	<div align="center">
				<a4j:outputPanel style="align:left" rendered="#{not empty crossMonitoringController.messageError}">
			   		<h:graphicImage value="/images/error.gif" rendered="#{not empty crossMonitoringController.messageError}" styleClass="errors" />
					<h:outputLabel value="#{crossMonitoringController.messageError}" rendered="#{not empty crossMonitoringController.messageError}" styleClass="errors"/>
					<rich:spacer height="20" rendered="#{not empty crossMonitoringController.messageError}"/>
				</a4j:outputPanel>
			</div>
		</a4j:outputPanel>
		
		
		<a4j:outputPanel id="reportFilePanel"> 
        	<div align="center">
				<a4j:outputPanel style="align:left" rendered="#{empty crossMonitoringController.messageError and
					not empty crossMonitoringController.fileName}">
					
					<h:commandLink action="#{crossMonitoringController.downloadFileExcel}">
						<h:graphicImage value="/images/excel_ico.jpg" style="align:center" />
					</h:commandLink>
					
				</a4j:outputPanel>
				
				<a4j:outputPanel style="align:left" rendered="#{empty crossMonitoringController.messageError and
					not empty crossMonitoringController.fileNamePDF}">
					
					<h:commandLink action="#{crossMonitoringController.downloadFilePdf}">
						<h:graphicImage value="/images/pdf_ico.jpg" style="align:center" />
					</h:commandLink>
					
				</a4j:outputPanel>
			</div>
		</a4j:outputPanel>
		
		<rich:modalPanel id="pnlModalProcess" autosized="true" minWidth="200">
	   		<center>
	      		<p>#{msg['general.processing']}</p>
			</center>
	    </rich:modalPanel>

<!-- 
		<div id="es" align="center">

			<h:panelGrid id="panelboton" columns="1" width="10%" border="0"
				style="align:center;">


				<h:graphicImage value="/images/pdf_ico.jpg"
					onclick="JSF4Actuate.pdf('x:report')" style=" align:center" />
				<h:graphicImage value="/images/excel_ico.jpg"
					onclick="JSF4Actuate.xls('x:report')" rendered="true" />
				<h:graphicImage value="/images/word_ico.gif"
					onclick="JSF4Actuate.doc('x:report')" rendered="false" />

			</h:panelGrid>
		</div>
		<rich:effect name="showDiv" for="es" type="Appear" />
		<rich:effect name="hideDiv" for="es" type="Fade" />

		<a4j:status id="idwait" onstart="#{rich:component('wait')}.show()"
			onstop="#{rich:component('wait')}.hide()" />
		<rich:modalPanel id="wait" autosized="true" width="100" height="40"
			moveable="false" resizeable="false">
			<h:graphicImage value="../images/spinner.gif" />
			<h:outputText value="Procesando..." />
		</rich:modalPanel>
		 -->
		 
		</h:form>
		
	</ui:define>

</ui:composition>